package com.fallsvc.ai.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther falls_vc
 * description:
 * @date 2025/10/29  23:37
 */
@Slf4j
@RestController
@RequestMapping("/openai")
public class OpenAIController {
    @Autowired
    private OpenAiChatModel openAiChatModel;

    @RequestMapping("/chat")
    public String chat(String message) {
        log.info("message:{}",message);
        return openAiChatModel.call(message);
    }
    @RequestMapping("/t")
    public String t() {
        return openAiChatModel.call("今天重庆天气怎么样?");
    }
}
